package in.freshstart.java.training.conditions;

public class DisplayGradeForPercentage {
	public static void main(String[] args) {
		int m1 = 30;
		int m2 = 40;
		int m3 = 66;
		float percentage;
		int total;
		total = m1 + m2 + m3;
		System.out.println("Total marks are " + total);
		percentage = ((float) (total * 100) / 300);
		System.out.println("Percentage is " + percentage);

		if (m1 < 40 || m2 < 40 || m3 < 40) {
			System.out.println("Student is failed in one of the subject");
			System.out.println("So we can't display grade for u");

		}

		else if (percentage >= 70 && percentage <= 100) {
			System.out.println("Grade 'A' With Distinction");

		} else if (percentage >= 60 && percentage < 70) {
			System.out.println("Grade 'A'");

		} else if (percentage >= 50 && percentage < 60) {
			System.out.println("Grade 'B'");

		} else if (percentage >= 40 && percentage < 50) {
			System.out.println("grade 'D'");
		} else if (percentage < 40) {
			System.out.println("Sorry u are failed");
		} else {
			System.out.println("please give valid data");
		}

	}
}
